package com.ly.hotel.spainterface.jxd.utils;

import com.ly.hotel.common.MyApplication;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * Created by ThinkPad on 2018/3/27.
 */

public class TimeUtils {

    // 将系统时间转换为毫秒
    public static long getSystemMills(){
        long time = 0;
        Calendar calendar = Calendar.getInstance();
        String nowTime = MyApplication.getInstance().nowTime;
        nowTime = nowTime.replace("-","");
        nowTime = nowTime.replace(":","");
        nowTime = nowTime.replace(" ","");
        try {
            calendar.setTime(new SimpleDateFormat("yyyyMMddHHmmss").parse(nowTime));
            time = calendar.getTimeInMillis();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return time;
    }

}
